//
//  YKRecommendUserCell.m
//  百思不得姐
//
//  Created by Eric.Wu on 16/2/25.
//  Copyright © 2016年 Eric.Wu. All rights reserved.
//

#import "YKRecommendUserCell.h"
#import "YKRecommendUserModel.h"
#import "UIImageView+WebCache.h"

@interface YKRecommendUserCell()
@property (weak, nonatomic) IBOutlet UIImageView *heardView;
@property (weak, nonatomic) IBOutlet UILabel *userName;
@property (weak, nonatomic) IBOutlet UILabel *fans;

@end
@implementation YKRecommendUserCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

   
}
+  (instancetype)cellWithTableView:(UITableView *)tableView
{
    static NSString *ID = @"user";
    YKRecommendUserCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (cell == nil) {
        cell = [[[NSBundle mainBundle] loadNibNamed:NSStringFromClass(self) owner:nil options:nil] lastObject];
    }
    return cell;
    
}

- (void)setUserModel:(YKRecommendUserModel *)userModel
{
    _userModel = userModel;
    self.userName.text = userModel.screen_name;
    NSString *fanscount = nil;
    if (userModel.fans_count < 10000) {
        fanscount =  [NSString stringWithFormat:@"%zd人关注",userModel.fans_count];
    }else{
        fanscount = [NSString stringWithFormat:@"%.1f万人关注",userModel.fans_count/10000.0];
    }
    self.fans.text = fanscount;
    [self.heardView sd_setImageWithURL:[NSURL URLWithString:userModel.header]placeholderImage:[UIImage imageNamed:@"defaultUserIcon"]];
}
@end
